PlantSight Enterprise Help

Creating Object Relationships Using the Hierarchy Selector

If the object tag contains the hierarchy information, then use the "hierarchySelector" to create the hierarchy from the tag.

The tag will be split by using "regex" . You can map the substrings in the "groupType" section.

This is an example for the creation of a hierarchy from for the following tag: "P20.H1.T3-V101"

"data": [
		{
			"selector": {
				"path": "$.items[*].properties[?(@.key==\"Tag number\")]",
				"regex": ".*"
			},
			"ecClass": {
				"name": "PUMP",
				"fullName": "ProcessFunctional.PUMP",
				"displayLabel": null
			},
			"mapping": [
				{
					"path": "$.items[*].properties[*].key",
					"regex": "Tag number",
					"target": "UserLabel",
					"validation": {
						"isMandatory": true,
						"dataType": "string"
					}
				},
				{
					"path": "$.items[*].properties[*].key",
					"regex": "Label",
					"target": "DESCRIPTION",
					"validation": {
						"isMandatory": false,
						"dataType": "string"
					}
				}
			],
			"hierarchySelector": {
			 	"groupType": [
				 	{
						"type": "element",
						"class": "ProcessFunctional.PS_PLANT",
						"delimiter": null
					},
					{
						"type": "relation",
						"class": "ProcessFunctional.PS_PLANT_HAS_PS_UNIT",
						"delimiter": "."
					},
					{
						"type": "element",
						"class": "ProcessFunctional.PS_UNIT",
						"delimiter": null
					},
					{
						"type": "relation",
						"class": "ProcessFunctional.PS_UNIT_HAS_PS_SUB_UNIT",
						"delimiter": "."
					},
					{
						"type": "element",
						"class": "ProcessFunctional.PS_SUB_UNIT",
						"delimiter": null
					},
					{
						"type": "relation",
						"class": "ProcessFunctional.PS_SUB_UNIT_HAS_NAMEN_ITEM",
						"delimiter": " "
					},
					{
						"type": "element",
						"class": "ProcessFunctional.PUMP",
						"delimiter": null
					}
				],
				"path": "$.properties[?(@.key==\"Tag number\")]",
				"regex": "^([a-zA-Z0-9]+)(\\.)([a-zA-Z0-9]+)(\\.)([a-zA-Z0-9]+)(\\ )(.*)$"
			}
		}
	],